home *** CD-ROM | disk | FTP | other *** search
- package Local.Game.Thing
- {
- import Local.Game.World.CPosition;
- import flash.geom.Point;
-
- public class CNode
- {
-
- public static const mGravityDelta:CPosition;
-
- {
- if(true)
- {
- mGravityDelta = CThingMath.mGravityDelta;
- }
- }
-
- public var mContraint:Number;
-
- public var mDelta:CPosition;
-
- private var mTraction:Boolean;
-
- public var mBounce:Number = 0.25;
-
- private var Break:Function;
-
- internal var mPrevNode:CNode;
-
- internal var mNextNode:CNode;
-
- public var mPosition:CPosition;
-
- private var mParent:CThingSprite;
-
- private var GetAltitude:Function;
-
- public var mGradient:CPosition;
-
- public function CNode(param1:Point, param2:CThingSprite, param3:CNode = null)
- {
- if(true)
- {
- mBounce = 0.25;
- if(true)
- {
- super();
- if(true)
- {
- mPosition = new CPosition(param1.x,param1.y);
- if(true)
- {
- mDelta = new CPosition(0,0);
- if(true)
- {
- mParent = param2;
- if(true)
- {
- mNextNode = param3;
- mGradient = new CPosition();
- }
- GetAltitude = mParent.GetAltitude;
- }
- Break = mParent.Break;
- }
- if(!mNextNode)
- {
- }
- §§goto(addr85);
- }
- GetAltitude = param2.GetAltitude;
- }
- mContraint = mPosition.subtract(mNextNode.mPosition).length;
- }
- addr85:
- }
-
- public function Flip() : void
- {
- var _loc1_:CPosition = null;
- _loc1_ = mNextNode.mPosition;
- mNextNode.mPosition = mPosition;
- mPosition = _loc1_;
- }
-
- private function _bounce(param1:Number) : void
- {
- var _loc2_:Number = NaN;
- if(true)
- {
- _loc2_ = param1 - mPosition.y;
- if(true)
- {
- mPosition.y = param1;
- if(true)
- {
- mDelta.y = -Math.abs(mDelta.y * mBounce);
- }
- if(mDelta.y > -0.5)
- {
- }
- §§goto(addr56);
- }
- mDelta.y = 0;
- }
- addr56:
- }
-
- public function Update() : Boolean
- {
- var _loc1_:Number = NaN;
- var _loc2_:CPosition = null;
- var _loc3_:CPosition = null;
- var _loc4_:* = NaN;
- var _loc5_:Number = NaN;
- mDelta.y += mGravityDelta.y;
- mPosition.Add(mDelta);
- _loc1_ = GetAltitude(mPosition.x);
- if(mPosition.y > _loc1_)
- {
- _bounce(_loc1_);
- mTraction = true;
- }
- else
- {
- mTraction = false;
- }
- §§push(mNextNode);
- if(true)
- {
- if(§§pop())
- {
- addr56:
- mNextNode.Update();
- _loc2_ = mPosition;
- _loc3_ = mNextNode.mPosition;
- mGradient.SetXY(_loc3_.x - _loc2_.x,_loc3_.y - _loc2_.y);
- §§push(mGradient.length);
- §§push(mGradient.length);
- if(true)
- {
- _loc4_ = §§pop();
- §§push(mContraint);
- if(true)
- {
- §§push(§§pop() - §§pop());
- §§push(_loc4_);
- }
- §§push(§§pop() * (0.5 + 0.5));
- }
- _loc5_ = §§pop() / §§pop();
- _loc2_.x += mGradient.x * 0.5 * _loc5_;
- _loc2_.y += mGradient.y * 0.5 * _loc5_;
- _loc3_.x -= mGradient.x * 0.5 * _loc5_;
- _loc3_.y -= mGradient.y * 0.5 * _loc5_;
- mParent.mAngle.mAngleRAD = Math.atan2(_loc3_.y - _loc2_.y,_loc3_.x - _loc2_.x);
- mParent.mPosition.SetXY(_loc2_.x + (_loc3_.x - _loc2_.x) / 2,_loc2_.y + (_loc3_.y - _loc2_.y) / 2);
- }
- else
- {
- mParent.mPosition.Copy(mPosition);
- }
- return mTraction;
- }
- §§goto(addr56);
- }
-
- public function Move(param1:CPosition) : Boolean
- {
- §§push(mPosition);
- if(true)
- {
- §§pop().Add(param1);
- if(mNextNode)
- {
- addr18:
- mNextNode.mPosition.Add(param1);
- }
- return true;
- }
- §§goto(addr18);
- }
-
- public function get hasTraction() : Boolean
- {
- if(mNextNode)
- {
- §§push(mNextNode.mTraction);
- if(true)
- {
- §§push(§§pop());
- if(true)
- {
- if(!§§pop())
- {
- if(true)
- {
- §§pop();
- §§goto(addr45);
- }
- else
- {
- addr44:
- addr45:
- §§push(mTraction);
- if(true)
- {
- addr32:
- §§push(§§pop() == true);
- }
- return §§pop();
- §§push(§§pop() == true);
- }
- §§goto(addr45);
- }
- §§goto(addr32);
- }
- §§goto(addr44);
- }
- §§goto(addr45);
- }
- else
- {
- §§push(mTraction);
- }
- §§goto(addr44);
- }
- }
- }
-